<?php 
/** Create By fu*/
namespace app\api\validate;
use app\api\validate\BaseValidate;

/**
* 
*/
class IDCollection extends BaseValidate
{
	
	protected $rule = [
		'ids'=>'require|checkIDs',
 	];

 	protected $message = [
 		'ids'=>'ids参数必须是以逗号分隔的多个正整数',
 	];

    //验证结果 return 给 error 属性
	protected function checkIDs($value,$rule='',$data='',$field='')
	{
		$values = explode(',', $value);
		if(empty($values))return false;

		foreach ($values as $id) {
			 
			if(!$this->isPositiveInteger($id))return false;
		}
		return true;
	}
}






 ?>